package top.saplf.sileny.base.ui

import android.app.Activity
import android.app.Application
import android.os.Bundle

/**
 * @author saplf
 */
object SilenyActivityCallbacks : Application.ActivityLifecycleCallbacks {
    override fun onActivityPaused(activity: Activity) {

    }

    override fun onActivityResumed(activity: Activity) {

    }

    override fun onActivityStarted(activity: Activity) {

    }

    override fun onActivityDestroyed(activity: Activity) {
    }

    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {

    }

    override fun onActivityStopped(activity: Activity) {

    }

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
        if (activity is IActivity) {
            activity.onViewPrepared(savedInstanceState)
            activity.setContentView(activity.onLayoutRes())
            activity.onViewCreated(savedInstanceState)
        }
    }
}